#include "../skyAdapter.h"

#ifdef _SYMBIAN
#include "../skySocket.h"
namespace Sky
{
		TBool Socket::open(String* ipAddr,TUint port){
			_sockets = CSIPExSocketEngine::NewLC(*this);
			TInetAddr addr;
			addr.Input(TPtrC(ipAddr->toCharString()));
			addr.SetPort(port);
			_sockets->ConnectL(addr);
		}
		TVoid Socket::close(){
			_sockets->Stop();
			delete _sockets;
		}
		TBool Socket::read(u8* lpBuf, TUint nCount,DoneCallback cb){
			_sockets->Read();
			_rcb = cb;
			return vTrue;
		}
		TBool Socket::write(u8* lpBuf, TUint nCount,DoneCallback cb){
			_sockets->Write(TPtrC8(lpBuf,nCount));
			_wcb = cb;
			return vTrue;
		}
}


#endif
